import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);

const state={
    count:1,
    dan:3
}


const mutations={
    add(state,pxp){
       state.count += pxp
    },
    reduce(state,pxp){
        state.count -= pxp
    }, 
    ja(state,pxp){
        state.dan += pxp
     },
     cd(state,pxp){
         state.dan -= pxp
     }
    // jia(et)
}

const actions={
        add(cxc,pxp){
            cxc.commit('add',pxp)
        }
        ,
        reduce(cxc,pxp){
            cxc.commit('reduce',pxp)
        }, 
        jad(cxc,pp){
            cxc.commit('ja',pp)
         },
         cdd(cxc,pp){
            cxc.commit('cd',pp)
         }
        //  cd({commit}){
        //     commit('cd')
        //  }
}

const getters={
      dan(state){
            return state.dan+=100
        }
}



export default new Vuex.Store({
        state,
        mutations,
        actions,
        getters
})
